-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Add --resolve-conflict flag to transport version generate task #134421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds an `--update` flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: `./gradlew generateTransportVersion --update`
Pinging @elastic/es-core-infra (Team:Core/Infra) |
Could this "just work" without specifying If the answer is "no", then let's rename the flag to something more explicit. Since |
The answer is indeed no as we cant distinguish between
Yeah, but that's not really what it's doing. This is what you run after you resolve the conflict by doing a merge. Really what we're trying to communicate with this flag is it's "non-destructive". It's not going to remove any existing transport ids, just "update" or "refresh" them to align with upstream changes. |
referableAndReferencedTransportVersion("new_tv", "8123000") | ||
file("myserver/src/main/resources/transport/latest/9.2.csv").text = | ||
""" | ||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention is that folks do a merge (address conflicts) and then run this task right? So we should never be in a position where we have conflicts in files? I mean either way, the content of the file is sort of irrelevant as we're just going to override it so the test is still valid as-is. Just want to understand the intent here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's the intention. You're right that the contents don't matter. I just made the test mimic the scenario as much as possible, and this is what it would like during a merge with a conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think the dev shouldn't have to resolve the conflicts in the generated files at all. I assume this is the intention still? So if that's the only conflict they can just run this gradle task again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think the dev shouldn't have to resolve the conflicts in the generated files at all. I assume this is the intention still?
I don't think we can avoid that. They are going to have to resolve those conflicts just like any other. The thing is that it doesn't really matter how they are resolved since we'll just fix it.
Files.writeString(path, upperBound.definitionName() + "," + upperBound.definitionId().complete() + "\n", StandardCharsets.UTF_8); | ||
|
||
if (stageInGit) { | ||
gitCommand("add", path.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really necessary? I mean we don't do this for any other kind of generation tasks. Can we not just rely on folks to do this themselves just as with any other local changes that need to be committed/pushed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary, but I think it's good. I don't think devs should think about the files that need to be added, when there is a conflict, they just run this command, and these files will no longer show as unresolved. Otherwise they would have to add themselves (or run git commit -a
, but not everyone does that with merge conflicts).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean we don't do this for any other kind of generation tasks
We could consider doing this for other files...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry if we don't add the files it would actually be more confusing since they are absolutely necessary to run ES so I'm +1 on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have super strong feelings on this but I'm generally -1 on things that muck with folks' local git state. There's just so many unique workflows people use and we just don't know when we might be stepping on those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the question is "how magic is the tool/transport versions". We don't auto-stage spotlessApply
because it's touching code we wrote. No magic. But we do auto-stage it when CI does spotlessApply
for us.
If transport versions are managed by the tool almost entirely, then, yeah, staging is nice and useful.
As far as commit -a
- whenever I get a merge conflict I manually git add
each resolved file one by one on the command line. But I'm old now. I have no idea what most folks do.
I'd be really creeped out if it auto-staged files it isn't managing. But that's not this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If transport versions are managed by the tool almost entirely, then, yeah, staging is nice and useful.
That's a fair distinction. In which case to my previous comment, I would then expect it to auto stage for any changes it makes to files it manages, not just when passing --resolve-conflict
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just thinking maybe it should auto-stage for anything involving the internal transport version files because we really don't expect or want users to have to consider these at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we expect folks to understand all those distinctions. Basically we don't expect folks to ever manually touch any of these files. If that's the case, then I agree with Nik that the task should just "own" these files and handle staging them in all scenarios if that's what we're gonna do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
|
||
@Input | ||
@Optional | ||
@Option(option = "update", description = "Update the transport version currently being added to upstream") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like @mark-vieira's suggestion of refresh
better than update
. Update implies we are working on something that already exists which the version being worked on doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per a suggestion from @nik9000 I've changed this to --resolve-conflict since that is what a developers is trying to do, resolve a merge conflict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh hey. Neat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per a suggestion from @nik9000 I've changed this to --resolve-conflict since that is what a developers is trying to do, resolve a merge conflict
I'm still not a fan, mainly because just running this task doesn't actually resolve the conflict. You still have to merge upstream changes and then run this task. I'll defer my objections though if that makes intuitive sense to most folks. I might be too close to this work to provide an objective opinion here.
It's worth noting that rather than having a single task and exposing this behavior as a cli option, we could just register another task with a better name that's preconfigured to do the right thing. For example just register a |
Does that indicate that we've neglected to collect certain requirements from the user? Why can't we tell this? |
+1 on a separate task. Seems more Gradley. |
Yes, because running the task with an empty set is perfectly fine, and actually the way most people will run it. Also, it's just super easy to forget. |
While that might work, the implementation will be annoying (having to duplicate much of the logic from the generate task). And I think it's simpler for devs to remember one task name for transport versions with a flag than two different tasks, but that's just a gut feeling which is easier to remember. |
I don't think that's true. It's what you run after you run |
My suggestion was just to use the same task type, just configure it differently so you wouldn't have to actually duplicate implementation logic.
Yeah, that might be true. Just figured I'd make it known that's an option. |
…ic#134421) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
…ic#134421) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
…ic#134421) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
…ic#134421) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
…) (#134662) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
…) (#134661) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
…) (#134660) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
…) (#134663) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
…ic#134421) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
…ic#134421) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
…ic#134421) (elastic#134660) When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a --resolve-conflict flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as: ./gradlew generateTransportVersion --resolve-conflict
When merge conflicts arise with transport versions we want to be able to regenerate ids for all the branches currently defined in the newly added transport version definition. This commit adds a
--resolve-conflict
flag to the generate task which figures out the appropriate branches automatically from the outstanding definition. With this the command line to regenerate on a merge conflict is as simple as:./gradlew generateTransportVersion --resolve-conflict